var t = require;
var e = module;
var o = exports;
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("GameData"),
    i = t("fun"),
    s = t("warehouse"),
    c = cc._decorator,
    l = c.ccclass,
    u = c.property,
    p = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (e.hp = null), (e.def = null), (e.att = null), (e.cit = null), (e.bck = null), e;
        }
        return (
            n(e, t),
            (e.prototype.onEnable = function () {
                (this.data = i.getView(s.default).herodata),
                    this.data.on(this, this.onChange, !0),
                    a.default.on("equips", this, this.onChange);
            }),
            (e.prototype.onChange = function () {
                var t = this.data.value;
                if (t) {
                    var e = i.getHeroLv(t.ID),
                        o = i.getHeroPars(t.ID, e),
                        n = i.getEquipsPars(t);
                    (this.hp.string = "" + (o.hp + n.h)),
                        (this.def.string = "" + (o.defence + n.d)),
                        (this.att.string = "" + (o.attack + n.a)),
                        (this.cit.string = 100 * o.Cirt + "%"),
                        (this.bck.string = 100 * o.Block + "%");
                }
            }),
            (e.prototype.onDisable = function () {
                a.default.off("equips", this, this.onChange), this.data.off(this, this.onChange), (this.data = null);
            }),
            r([u(cc.Label)], e.prototype, "hp", void 0),
            r([u(cc.Label)], e.prototype, "def", void 0),
            r([u(cc.Label)], e.prototype, "att", void 0),
            r([u(cc.Label)], e.prototype, "cit", void 0),
            r([u(cc.Label)], e.prototype, "bck", void 0),
            (e = r([l], e))
        );
    })(cc.Component);
o.default = p;
